package com.probox.common.entity.domain.platfom;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.probox.common.core.annotation.Excel;
import com.probox.common.core.text.Convert;
import com.probox.common.entity.utils.DictUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;


/**
 * 门店信息对象 platform_store
 *
 * @author usoft
 * @date 2021-08-20
 */
@Data
@Accessors(chain = true)
@TableName("platform_store")
@ApiModel(description = "门店信息")
public class PlatformStore implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * $column.columnComment
     */
    //默认主键自增
    @TableId(value = "STORE_UID", type = IdType.AUTO)
    private Long storeUid;

    /**
     * 平台uid
     */
    @Excel(name = "平台uid")
    @ApiModelProperty(value = "平台uid")
    private Long platformUid;

    /**
     * appid
     */
    @Excel(name = "appid")
    @ApiModelProperty(value = "appid")
    private String appid;

    /**
     * 门店名称
     */
    @Excel(name = "门店名称")
    @ApiModelProperty(value = "门店名称")
    private String storeName;

    /**
     * 门店类型
     */
    @Excel(name = "门店类型")
    @ApiModelProperty(value = "门店类型")
    private String storeType;


    /**
     * 服务类别(Life-生美/Medical-医美/probxplus-菠萝+)
     */
    @Excel(name = "服务类别")
    @ApiModelProperty(value = "服务类别")
    private String serviceType;

    public String getStoreTypeStr() {

        if (ObjectUtil.isEmpty(storeType)) {
            return "";
        }
        HashMap typeMap = DictUtils.getDictCacheMap("STORE_TYPE");
        return Convert.toStr(typeMap.get(storeType));

    }



    public String getServiceTypeStr() {

        if (ObjectUtil.isEmpty(serviceType)) {
            return "";
        }
        HashMap typeMap = DictUtils.getDictCacheMap("proBoxService_itemType");
        return Convert.toStr(typeMap.get(serviceType));

    }


    /**
     * 联系人
     */
    @Excel(name = "联系人")
    @ApiModelProperty(value = "联系人")
    private String storeContacts;

    /**
     * 联系电话
     */
    @Excel(name = "联系电话")
    @ApiModelProperty(value = "联系电话")
    private String storePhone;

    /**
     * 门店省份
     */
    @Excel(name = "门店省份")
    @ApiModelProperty(value = "门店省份")
    private String storeProvince;

    /**
     * 门店城市
     */
    @Excel(name = "门店城市")
    @ApiModelProperty(value = "门店城市")
    private String storeCity;

    /**
     * 门店区域
     */
    @Excel(name = "门店区域")
    @ApiModelProperty(value = "门店区域")
    private String storeArea;

    /**
     * 门店详细地址
     */
    @Excel(name = "门店详细地址")
    @ApiModelProperty(value = "门店详细地址")
    private String storeAddress;

    /**
     * 门店banner
     */
    @Excel(name = "门店banner")
    @ApiModelProperty(value = "门店banner")
    private String storeBanner;

    public String [] getStoreBannerArr(){
        if(ObjectUtil.isEmpty(storeBanner)) return null;
        return storeBanner.split(",");
    }

    public String  getStoreBannerOne(){
        if(ObjectUtil.isEmpty(storeBanner)) return null;
        return storeBanner.split(",")[0];
    }

    /**
     * 门店详情图
     */
    @Excel(name = "门店详情图")
    @ApiModelProperty(value = "门店详情图")
    private String storeImg;

    public String [] getStoreImgArr(){
        if(ObjectUtil.isEmpty(storeImg)) return null;
        return storeImg.split(",");
    }

    public String  getStoreImgOne(){
        if(ObjectUtil.isEmpty(storeImg)) return null;
        return storeImg.split(",")[0];
    }


    /**
     * 经度
     */
    @Excel(name = "经度")
    @ApiModelProperty(value = "经度")
    private String storeLongitude;

    /**
     * 纬度
     */
    @Excel(name = "纬度")
    @ApiModelProperty(value = "纬度")
    private String storeLatitude;

    /**
     * 状态（1有效/0无效)
     */
    @Excel(name = "状态", readConverterExp = "状态（1有效/0无效)")
    @ApiModelProperty(value = "状态")
    private String dataStatus;

    /**
     * 审核状态
     */
    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private String auditStatus;

    /**
     * $column.columnComment
     */
    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private Long createUid;

    /**
     * $column.columnComment
     */
    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private String createName;

    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "审核状态", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "审核状态")
    private Date createTime;

    /**
     * $column.columnComment
     */
    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private Long updateUid;

    /**
     * $column.columnComment
     */
    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private String updateName;

    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "审核状态", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "审核状态")
    private Date updateTime;

    /**
     * 审核人ID
     */
    @Excel(name = "审核人ID")
    @ApiModelProperty(value = "审核人ID")
    private Long auditUid;

    /**
     * 审核人名称
     */
    @Excel(name = "审核人名称")
    @ApiModelProperty(value = "审核人名称")
    private String auditName;

    /**
     * 审核人时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "审核人时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "审核人时间")
    private Date auditTime;

    /**
     * 客户id
     */
    @Excel(name = "客户id")
    @ApiModelProperty(value = "客户id")
    private Long customerUid;


    @Excel(name = "商户名称")
    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @Excel(name = "商户ID")
    @ApiModelProperty(value = "商户ID")
    private String merchantId;

    @TableField(exist = false)
    private List<String> types;

    private String storeVideo;

    public PlatformStore() {
    }

    public PlatformStore(Long storeUid, Long platformUid) {
        this.storeUid = storeUid;
        this.platformUid = platformUid;
    }

    /**
     * 营业状态
     */
    private String occupationStatus;

    private String timeStatus;

    private String occupationTime;

}
